package com.yc.testPro;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TestGC {
	
	public void m1() {
		List<TestEntity> list = new ArrayList<TestEntity>();
		TestEntity te = new TestEntity("张三", 21);
		list.add(te);
		te = null;
		System.out.println("name=" + list.get(0).getName());
	}
	
	public void m2() {
		Map<String, TestEntity> mt = new HashMap<String, TestEntity>();
		TestEntity te1 = new TestEntity("张三", 21);
		TestEntity te2 = new TestEntity("张三2", 22);
		mt.put("张三", te1);
		mt.put("张三2", te2);
		System.out.println("mt.size()=" + mt.size());
		mt.get("张三").setAge(23);//修改
		TestEntity res = mt.remove("张三");
		System.out.println("mt.size()=" + mt.size());
	}

	public static void main(String[] args) {
		TestGC tg = new TestGC();
		tg.m2();

	}

}
